// const mapTag = '[object Map]'
// const setTag = '[object Set]'
// const arrayTag = '[object Array]'
// const objectTag = '[object Object]'

// const boolTag = '[object Boolean]'
// const dateTag = '[object Date]'
// const errorTag = '[object Error]'
// const numberTag = '[object Number]'
// const regexpTag = '[object RegExp]'
// const stringTag = '[object String]'
// const symbolTag = '[object Symbol]'

// 方法用于删除字符串的头尾空白符，空白符包括：空格、制表符 tab、换行符等其他空白符等

export const trim = (val: any) => {
  let str = val
  str = str.replace(/^\s+/, '')
  for (let i = str.length - 1; i >= 0; i--) {
    if (/\S/.test(str.charAt(i))) {
      str = str.substring(0, i + 1)
      break
    }
  }
  return str
}

// 将普通的数字转换为带千位分隔符格式的数字字符串
export const numFormat = (num: any) => {
  const res = num.toString().replace(/\d+/, function (n: any) {
    return n.replace(/(\d)(?=(\d{3})+$)/g, function ($1: any) {
      return $1 + ','
    })
  })
  return res
}
